export default {
  namespaced: true,
  state: {
    tagsList: [],
  },
  getters: {
    getTagsList: (state) => {
      return state.tagsList
    },
  },
  mutations: {
    SET_TAGS_LIST(state, list) {
      state.tagsList = list
    },
    CLEAR_TAGS_LIST(state) {
      state.tagsList = []
    },
  },
  actions: {
    /* 赋值tags */
    updatedTags({ commit }, list = []) {
      // 去掉添加的重定向路由
      const arr = list.filter((o) => {
        return o.path.indexOf('/redirect/') < 0
      })
      commit('SET_TAGS_LIST', arr)
    },
    /* 清除tabs信息 */
    clearTags({ commit }) {
      commit('CLEAR_TAGS_LIST')
    },
  },
}
